<?php
defined('IN_PHPCMS') or exit('No permission resources.');
pc_base::load_sys_class('model', '', 0);
class buy_product_reply_model extends model {
	function __construct() {
		$this->db_config = pc_base::load_config('database');
		$this->db_setting = 'default';
		$this->table_name = 'buyproduct_reply';
		$this->_username = param::get_cookie('_username');
		$this->_userid = param::get_cookie('_userid');
		parent::__construct();
	}
	function add_relpy($data){
		
		return $this->insert($data);
	}
	function get_list($id, $offset, $pagesize){
		$sql = 'SELECT a.*,b.business_name  from '.$this->table_name.' as a 
		left join v9_member_business  as b on a.userid = b.userid 
		where a.id =  \''.$id.'\' order by rid desc ';
		$sql .= " LIMIT $offset,$pagesize ";
		$this->query($sql);
		return $this->fetch_array();
	}
	function get_list_count($id){
		$sql_count = 'SELECT count(rid) as cnt from '.$this->table_name.' where id = \''.$id.'\' order by rid desc';
		$this->query($sql_count);
		return  $this->fetch_array();
	}
	
}
?>